#!/bin/sh

if rpm -qa|grep 'qmail-toaster' >/dev/null 2>&1 ; then
	echo
	echo "Mail server already use qmail-toaster"
	echo
	if ! [ "$1" == "--force" ] ; then
		exit
	fi
else
	echo
	echo "Mail server already use qmail from LxCenter"
	echo "Convert processing..."
	echo
fi

yum remove qmail* vpopmail* *-toaster exim* dovecot* postfix* -y
rpm -e --noscripts vpopmail
yum clean all
yum install *toaster -y

sh /script/fix-qmail-assign
'rm' -f /etc/xinetd.d/*_lxa
chkconfig courier-imap off

'rm' -f /etc/rc.d/init.d/courier-imap

echo 'localhost' > /var/qmail/control/locals

sh /script/fixvpop
sh /script/cleanup

echo "Need reboot!"
echo